﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Cors;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(ChanTai.WebApi.Startup))]
namespace ChanTai.WebApi
{
    /// <summary>
    /// WebApi启动
    /// </summary>
    public class Startup
    {
        /// <summary>
        /// WebApi配置
        /// </summary>
        /// <param name="appBuilder"></param>
        public void Configuration(IAppBuilder appBuilder)
        {
            // Configure Web API for self-host.   
            var config = new HttpConfiguration();
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", new { id = RouteParameter.Optional });
            SwaggerConfig.Register(config);
            config.EnableCors(new EnableCorsAttribute("*", "*", "*"));
            appBuilder.UseWebApi(config);
        }
    }
}
